Merged
Conversation
dev-jodee
reviewed
Mar 25, 2026
program/src/instructions/points/close_points_account/processor.rs
Outdated
Show resolved
Hide resolved
dev-jodee
reviewed
Mar 25, 2026
amilz
added a commit
that referenced
this pull request
Mar 30, 2026
- Enrich all points events with full config fields (authority, seed, max_supply, transferable, revocable, total_issued, total_used) so indexers don't need extra account fetches - Add self-transfer guard in transfer_points to prevent from_account write being clobbered by to_account write on same PDA - Add validate_zero_balance() helper on UserPointsAccount, use in close_points_account - Replace ExpectedPointsConfig struct with individual params in test assertions for consistency with existing patterns - Regenerate IDL and clients
dev-jodee
previously approved these changes
Mar 30, 2026
Collaborator
dev-jodee
left a comment
There was a problem hiding this comment.
just a couple of nits but rest looks good
amilz
added a commit
that referenced
this pull request
Mar 30, 2026
- Enrich all points events with full config fields (authority, seed, max_supply, transferable, revocable, total_issued, total_used) so indexers don't need extra account fetches - Add self-transfer guard in transfer_points to prevent from_account write being clobbered by to_account write on same PDA - Add validate_zero_balance() helper on UserPointsAccount, use in close_points_account - Replace ExpectedPointsConfig struct with individual params in test assertions for consistency with existing patterns - Regenerate IDL and clients
9a72df4 to
8c8999f
Compare
amilz
added a commit
that referenced
this pull request
Mar 30, 2026
- Refactor cpi_* free functions into PointsCpi struct (dev-jodee) - Remove unused _system_program param from initialize_points_mint - Move ATA validation from processors into accounts.rs - Error on zero-balance revoke with PointsNothingToRevoke
dev-jodee
approved these changes
Mar 30, 2026
Add points type as fourth distribution paradigm — pure u64 PDA ledger with no token programs. Authority issues/closes, user cosigns use/transfer. Accounts: PointsConfig, UserPointsAccount Instructions: init_points, issue_points, use_points, transfer_points, close_points_account, close_points_config
Authority can force-burn a user's points and close their account when config.revocable is set. Gated on validate_revocable check. Revoked balance counted as used. Also adds intentional-design comment to close_points_config explaining admin authority over lifecycle.
7 fixture files, 8 test files covering all points instructions. Includes generic constraint tests, business logic error paths, PDA mismatch validation, and end-to-end lifecycle test.
- Enrich all points events with full config fields (authority, seed, max_supply, transferable, revocable, total_issued, total_used) so indexers don't need extra account fetches - Add self-transfer guard in transfer_points to prevent from_account write being clobbered by to_account write on same PDA - Add validate_zero_balance() helper on UserPointsAccount, use in close_points_account - Replace ExpectedPointsConfig struct with individual params in test assertions for consistency with existing patterns - Regenerate IDL and clients
Add helpers on state structs to replace raw checked arithmetic in processors: add_balance, sub_balance, add_issued, add_used, validate_zero_balance. Processors now read as clean intent rather than manual field manipulation.
Add 13 new integration tests covering missing error paths, edge cases, and cross-instruction flows for the points system.
… in close_points_account - Add explicit points_mint PDA validation to all 6 post-init processors (defense-in-depth against mint substitution) - close_points_account now actually closes the user's ATA via Token-2022 CloseAccount CPI (user signs as account owner, receives rent refund) - Clarify POINTS_MINT_SPACE comment with full layout breakdown
- Refactor cpi_* free functions into PointsCpi struct (dev-jodee) - Remove unused _system_program param from initialize_points_mint - Move ATA validation from processors into accounts.rs - Error on zero-balance revoke with PointsNothingToRevoke
Points::initialize, Points::issue, Points::burn, Points::close_account, Points::close_mint, Points::create_account
202e6b0 to
3426630
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Test plan
cargo clippy -D warningsclean on program and testscargo fmt --checkcleanCloses TOO-197